package emby.expr;

import emby.EmbyRuntime;
import emby.lang.EmbyNull;
import emby.lang.Scope;
import emby.writer.IEmbyCodifier;

/**
 * A boolean, integer, double, or string literal
 * @author Justin
 */
public class Literal extends Expression{

	public final static Literal ONE = new Literal(new Integer(1));
	public final static Literal TRUE =  new Literal(Boolean.TRUE);
	public final static Literal FALSE =  new Literal(Boolean.FALSE);
	public final static Literal NULL = new Literal(EmbyNull.Null);

	private static final long serialVersionUID = -4281337755830240029L;
		public final Object val;
		public Literal(Object value){
			val = value;
		}
		public Object eval(Scope s){

			if(EmbyRuntime.echo){
				emby.util.Print.println("Evaluating literal "+val);
			}
			return val;
		}
		public String toString(){
			return "{Literal: "+val+"}";
		}
		public void codify(IEmbyCodifier ec){
			ec.literal(val);
		}
}
